﻿using System;

namespace BaseSyntax.CompareTest
{
	public class Person:IComparable
	{
		public int Age;

		public Person(int ag1)
		{
			Age = ag1;
		}
		
		public int CompareTo(object obj)
		{
			Console.WriteLine("compare to");
			if (obj is Person)
			{
				return this.Age - (obj as Person).Age;
			}
			else
			{
				return 1;
			}
		}
	}
}